import time
from selenium import webdriver
from selenium.webdriver.common.by import By
from selenium.webdriver.support import expected_conditions
from selenium.webdriver.support.wait import WebDriverWait

driver = webdriver.Chrome()
driver.maximize_window()
driver.get("http://127.0.0.1/index.php/Admin/Admin/login")

login_username=(By.NAME, 'username')
driver.find_element(*login_username).send_keys("admin")

login_pwd=By.NAME, 'password'
driver.find_element(*login_pwd).send_keys("123456")

login_verify_code=By.NAME, 'vertify'
driver.find_element(*login_verify_code).send_keys('8888')

#登录按钮
login_btn=By.NAME, 'submit'
driver.find_element(*login_btn).click()

shop_tab=By.LINK_TEXT, '商城'
WebDriverWait(driver, timeout=10, poll_frequency=0.5).until(lambda x: x.find_element(*shop_tab)).click()


add_product_button=By.CSS_SELECTOR, 'div[title="添加商品"]'

WebDriverWait(driver, timeout=10, poll_frequency=0.5).until(lambda x: x.find_element(*add_product_button)).click()